package com.zhiliang.waibao.myapplication.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;

import com.zhiliang.waibao.myapplication.R;

public class CircleView extends View {
    Paint paint = new Paint();
       Path path=new Path();
    //    Paint 类的几个最常用的方法。具体是：
//            Paint.setStyle(Style style) 设置绘制模式
//Paint.setColor(int color) 设置颜色
//Paint.setStrokeWidth(float width) 设置线条宽度
//Paint.setTextSize(float textSize) 设置文字大小
//Paint.setAntiAlias(boolean aa) 设置抗锯齿开关
    public CircleView(Context context) {
        super(context);
    }

    public CircleView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public CircleView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }



    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        paint.setColor(getResources().getColor(R.color.colorPrimaryDark));
        paint.setStrokeWidth(5);
        paint.setStyle(Paint.Style.STROKE);
        canvas.drawCircle(200, 200, 50, paint);
        path.addCircle(400,400,50,Path.Direction.CW);
        canvas.drawPath(path,paint);
    }
}
